

Page({
  data: {
    swiperList:[],
    catesList:[],
    floorList:[],
  },
imgs:[],
prevImg(e){
  wx.previewImage({
    current:e.currentTarget.dataset.src,
    urls: this.imgs,
  })
},
onLoad: function(){
  this.getSwiperList();
  this.getCateList();
  this.getFloorList();
},
getSwiperList(){
  wx.request({
    url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
    success:(result) =>{
      this.setData({
        swiperList:result.data.message
      })
      this.data.swiperList.forEach(item=>{
        this.imgs.push(item.image_src)
      })
    }
  })
},
getCateList(){
  wx.request({
    url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/catitems',
    success:res =>{
      this.setData({
        catesList:res.data.message
      })
    }
  })
},
getFloorList(){
  wx.request({
    url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/floordata',
    success:(result)=>{
    //   result.data.message.map(data1=>{
    //     data1.product_list.map(data2=>{
    //       var navigator_url = data2.navigator_url;
    //        var ursl = navigator_url.split("?");
    //        navigator_url = ursl[0]+"/index?"+ursl[1];
    //        data2.navigator_url = navigator_url;
    //     })
    // })
      this.setData({
        floorList:result.data.message
      })
      
    }
  })
}

})
